﻿using System;
using System.ComponentModel;
using System.Runtime.Serialization;
using Esponce.Common;

namespace Esponce.QRCode
{
	[DataContract(Name = "campaign", Namespace = "")]
	public class TrackCampaign : INotifyPropertyChanged
	{
		#region Public properties
		[DataMember(Name = "id", IsRequired = false, EmitDefaultValue = false, Order = 1)]
		public string Id
		{
			get
			{
				return this.id;
			}
			set
			{
				if (this.id != value)
				{
					this.id = value;
					OnPropertyChanged("Id");
				}
			}
		}
		private string id;

		[DataMember(Name = "name", IsRequired = false, EmitDefaultValue = false, Order = 2)]
		public string Name
		{
			get
			{
				return this.name;
			}
			set
			{
				if (this.name != value)
				{
					this.name = value;
					OnPropertyChanged("Name");
				}
			}
		}
		private string name;

		[DataMember(Name = "description", IsRequired = false, EmitDefaultValue = false, Order = 3)]
		public string Description
		{
			get
			{
				return this.description;
			}
			set
			{
				if (this.description != value)
				{
					this.description = value;
					OnPropertyChanged("Description");
				}
			}
		}
		private string description;

		[DataMember(Name = "created", IsRequired = false, EmitDefaultValue = false, Order = 4)]
		public string CreatedISO8601
		{
			get
			{
				return ISO8601.GetString(this.Created);
			}
			set
			{
				this.Created = ISO8601.GetDateTime(value);
			}
		}

		public DateTime? Created
		{
			get
			{
				return this.created;
			}
			set
			{
				if (this.created != value)
				{
					this.created = value;
					OnPropertyChanged("Created");
				}
			}
		}
		private DateTime? created;
		#endregion

		#region INotifyPropertyChanged Members
		public event PropertyChangedEventHandler PropertyChanged;
		protected virtual void OnPropertyChanged(string propertyName)
		{
			if (PropertyChanged != null)
			{
				PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
		#endregion
	}
}
